global path "G:\My Drive\Dissertation"	//Percy's path
*global path "C:\Users\jbucheli\Google Drive Streaming\.shortcut-targets-by-id\1EWiHHsz4sWi5eblqcHzRWF03rnGHsxZe\Dissertation"	//Dr. Bucheli's path

cd "$path"
use "STATA DATA Files/Mobambique and SSA Countires permit abortion to save womans life.dta", clear

append using "STATA DATA Files/Mozambique and all SSA Countries except those with abortion laws.dta"
append using "STATA DATA Files/Mozambique and SSA Countires that abortion is strictly prohibited.dta"
append using "STATA DATA Files/Mozambique and SSACountries that permit abortion on health Grounds.dta"
append using "STATA DATA Files/Mozambique and Zambia( Both have liberal abortion laws).dta"

*Drop duplicates
duplicates drop year CountryName, force
duplicates report year CountryName

*Generate unique country code
drop C_ID c_id C_id
sort CountryName year
egen country_id = group(CountryName)
order country_id CountryName

*Generate sample identifiers
gen sample1 = 1 if inlist(CountryName,"Cote d'Ivoire","Gabon","Malawi","Mali")
replace sample1 = 1 if inlist(CountryName,"Mozambique","Nigeria","Somalia","South Sudan")
replace sample1 = 1 if inlist(CountryName,"Sudan","Tanzania","Uganda")
label variable sample1 "Mobambique and SSA Countires permit abortion to save womans life"

gen sample2 = 1 if inlist(CountryName,"Angola","Botswana","Burkina Faso")
replace sample2 = 1 if inlist(CountryName,"Burundi","Cameroon","Central African Republic","Chad")
replace sample2 = 1 if inlist(CountryName,"Comoros","Congo, Dem. Rep.","Congo, Rep.","Cote d'Ivoire")
replace sample2 = 1 if inlist(CountryName,"Equatorial Guinea","Eritrea","Eswatini","Ethiopia")
replace sample2 = 1 if inlist(CountryName,"Gabon","Gambia, The","Ghana","Guinea")
replace sample2 = 1 if inlist(CountryName,"Kenya","Lesotho","Liberia","Madagascar")
replace sample2 = 1 if inlist(CountryName,"Malawi","Mali","Mauritania","Mozambique")
replace sample2 = 1 if inlist(CountryName,"Namibia","Niger","Nigeria","Rwanda")
replace sample2 = 1 if inlist(CountryName,"Senegal","Seychelles","Sierra Leone","Somalia")
replace sample2 = 1 if inlist(CountryName,"South Sudan","Sudan","Tanzania","Togo")
replace sample2 = 1 if inlist(CountryName,"Uganda","Zimbabwe","Mauritius")
label variable sample2 "Mozambique and all SSA Countries except those with legal abortion laws"

gen sample3 = 1 if inlist(CountryName,"Congo, Rep.","Madagascar","Mauritania")
replace sample3 = 1 if inlist(CountryName,"Mozambique","Senegal","Sierra Leone")
label variable sample3 "Mozambique and SSA Countires that abortion is strictly prohibited"

gen sample4 = 1 if inlist(CountryName,"Angola","Botswana","Burkina Faso")
replace sample4 = 1 if inlist(CountryName,"Burundi","Cameroon","Central African Republic")
replace sample4 = 1 if inlist(CountryName,"Chad","Congo, Dem. Rep.","Equatorial Guinea")
replace sample4 = 1 if inlist(CountryName,"Eritrea","Eswatini","Ghana")
replace sample4 = 1 if inlist(CountryName,"Guinea","Kenya","Lesotho")
replace sample4 = 1 if inlist(CountryName,"Liberia","Mozambique","Namibia","Niger","Togo")
label variable sample4 "Mozambique and SSACountries that permit abortion on health Grounds"

gen sample5 = 1 if inlist(CountryName,"Mozambique","Zambia") 
label variable sample5 "Mozambique and Zambia( Both have liberal abortion laws)"


compress
save "STATA DATA Files/Merged data.dta", replace


